package com.tangyee.home_knowledge.util;

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

/**
 * @author: yu huawen
 * @date: 2019/1/31 11:58
 */
public class KeyBoardUtil {

    /**
     * 影长键盘
     * @param view 上一级传入的 getWindow().getDecorView() 得到的 view
     */
    public static void hideKeyBoard(View view){
        InputMethodManager imm = ( InputMethodManager ) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE );
        if ( imm.isActive( ) ) {
            imm.hideSoftInputFromWindow( view.getApplicationWindowToken() , 0 );
        }
    }
}
